#ifndef __PID_H__
#define __PID_H__

#include <stdint.h>

typedef struct
{
	float output;
	
	float err_0;
	float err_1;
	float err_2;
	
	float Kp;
	float Ki;
	float Kd;
	uint8_t direct;
	uint8_t delay;
}PID_SET;

void PID_Init(PID_SET *pid, float kp, float ki, float kd, uint8_t direct, float base);
void PID_SetCoeff(PID_SET *pid, float kp, float ki, float kd);
float PID_Control(PID_SET *pid, float pv, float setpt, uint8_t tick, uint8_t defaultDelay, uint8_t freq_hold);

#endif
